<template>
  <div>
    <el-table
      class="table-bg"
      :data="list">
      <el-table-column
        prop="id"
        label="管理员id">
      </el-table-column>
      <el-table-column
        prop="name"
        label="名称">
      </el-table-column>
      <el-table-column
        prop="account"
        label="账号">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="手机号码">
      </el-table-column>
      <el-table-column
        prop="status"
        label="状态">
        <template slot-scope='scope'>
          <span v-if='scope.row.status === 0'>可用</span>
          <span v-else>锁定</span>
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作">
        <template slot-scope="scope">
          <el-button @click="readData(scope.row.tid)" type="text" size="small">查看</el-button>
          <el-button @click="createData" type="text" size="small">创建</el-button>
          <el-button @click="deleteData(scope.row.tid)" type="text" size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { allAdmin } from 'api/admin'
export default {
  data () {
    return {
      list: []
    }
  },
  mounted () {
    this._getList()
  },
  methods: {
    _getList () {
      allAdmin().then(res => {
        this.list = res
      })
    },
    readData () {

    },
    createData () {
      this.$router.push({ path: '/admin/admin/create' })
    }
  }
}
</script>

<style scoped>
.table-bg{
  background-color: rgba(255,255,255,.1)
}
</style>
